using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using emp.Model;
using emp.BLL;
using emp.IDAL;

namespace emp.ProcessFlow
{
    public class CampacignController
    {
        public bool Insert(CampaignInfo camInfo)
        {
            try
            {
                // Creata a new business logic tier
                emp.BLL.Campaign campaign = new emp.BLL.Campaign();
                // Call the insert method
                int id=campaign.Insert(camInfo);
                if (id > 0)
                {
                    HttpContext.Current.Response.Redirect("CampaignModify.aspx?cam_uid=" + id);
                }

            }
            catch
            {
                return false;
            }
            return true;
        }

        public void Update(CampaignInfo camInfo,string pageNum)
        {
            Campaign cambll = new Campaign();
            cambll.updateCampaign(camInfo);
            HttpContext.Current.Response.Redirect("CampaignList.aspx?pageNum=" + pageNum);
        }
        public void OperationCampaign(string type, string cam_uid, string pageNum)
        {
            Campaign cambll = new Campaign();
            cambll.operationCampaign(type, cam_uid);
            string url = "CampaignList.aspx?pageNum="+pageNum;
            HttpContext.Current.Response.Redirect(url, true);
        }
    }
}
